<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>资产管理系统</title>
    <!--引入elementui样式类-->
    <link rel="stylesheet" th:href="@{/css/index.css}">
    <link rel="stylesheet" th:href="@{/js/index.css}">
    <link rel="stylesheet" th:href="@{/js/scrollbar.css}">
    <link rel="shortcut icon" th:href="@{/img/favicon2.ico}"/>
    <script src="/js/jquery-3.2.1.js"></script>
    <script src="/js/jquery.cookie.js"></script>
    <style>
        .el-menu-vertical-demo:not(.el-menu--collapse) {
            width: 200px;
            height: 100%;
            border: none;
        }

        .icon-warp {
            font-size: 20px;
        }

        .show-i {
            float: left;
        }

        .show-i i {
            font-size: 35px;
            color: white;
        }

        .el-dropdown-menu {
            top: 57px !important;
        }

        a{
            text-decoration: none;
        }
    </style>
</head>
<body>
<div id="app">

    <el-container>
        <el-aside :width="isCollapse ? '65px' : '200px'" style="background-color: #545c64 ;">
            <el-menu
                    default-active="1-1"
                    class="el-menu-vertical-demo"
                    background-color="#545c64"
                    text-color="#fff"
                    active-text-color="#ffd04b"
                    :collapse="isCollapse"
                    :collapse-transition="false"
            >
                <el-menu-item style="height: 60px">
                    <div class="icon-warp">
                        <img src="/img/icon1.png">
                        <span slot="title">资产管理系统</span>
                    </div>
                </el-menu-item>
                <el-submenu index="1">
                    <template slot="title">
                        <i class="el-icon-notebook-1"></i>
                        <span>资产管理</span>
                    </template>
                    <el-menu-item-group>
                        <a th:href="@{asset_srch}" target="openArea">
                            <el-menu-item index="1-1">
                                <i class="el-icon-search"></i>
                                <span slot="title">资产查询</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{asset_classify}" target="openArea">
                            <el-menu-item index="1-8">
                                <i class="el-icon-c-scale-to-original"></i>
                                <span slot="title">资产分类</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{aro_list}" target="openArea">
                            <el-menu-item index="1-2">
                                <i class="el-icon-finished"></i>
                                <span slot="title">待审批一览</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{user_apply}" target="openArea" shiro:lacksRole="employee">
                            <el-menu-item index="1-7">
                                <i class="el-icon-s-data"></i>
                                <span slot="title">所有人申请一览</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{depreciation}" target="openArea">
                            <el-menu-item index="1-4">
                                <i class="el-icon-s-release"></i>
                                <span slot="title">资产报废</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{asset_worthless}" target="openArea">
                            <el-menu-item index="1-5">
                                <i class="el-icon-document-delete"></i>
                                <span slot="title">不可用资产一览</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{asset_type_rate}" target="openArea">
                            <el-menu-item index="1-6">
                                <i class="el-icon-pie-chart"></i>
                                <span slot="title">各种资产的占比</span>
                            </el-menu-item>
                        </a>
                    </el-menu-item-group>
                </el-submenu>
                <el-submenu index="3">
                    <template slot="title">
                        <i class="el-icon-goods"></i>
                        <span>个人资产</span>
                    </template>
                    <el-menu-item-group>
                        <a th:href="@{person_asset}" target="openArea">
                            <el-menu-item index="3-3">
                                <i class="el-icon-sell"></i>
                                <span slot="title">个人资产</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{person_apply}" target="openArea">
                            <el-menu-item index="3-1">
                                <i class="el-icon-document"></i>
                                <span slot="title">个人申请一览</span>
                            </el-menu-item>
                        </a>
                    </el-menu-item-group>
                </el-submenu>
                <el-submenu index="2">
                    <template slot="title">
                        <i class="el-icon-user-solid"></i>
                        <span>用户管理</span>
                    </template>
                    <el-menu-item-group>
                        <a th:href="@{user_list}" target="openArea">
                            <el-menu-item index="2-1" >
                                <i class="el-icon-search"></i>
                                <span slot="title">用户查询</span>
                            </el-menu-item>
                        </a>
                        <a th:href="@{userAro_list}" target="openArea">
                            <el-menu-item index="2-2" >
                                <i class="el-icon-s-data"></i>
                                <span slot="title">用户申请一览</span>
                            </el-menu-item>
                        </a>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </el-aside>
        <el-container>
            <el-header style="font-size: 14px;background-color:#545c64;margin-left: -20px;line-height: 60px ">
                <div class="show-i" style="margin-top: 8px">
                    <div v-show="isShow" @click="toggleCollapse">
                        <i class="el-icon-s-fold"></i>
                    </div>
                    <div v-show="!isShow" @click="toggleCollapse">
                        <i class="el-icon-s-unfold"></i>
                    </div>
                </div>
                <el-dropdown style="float: right ;line-height: 60px">
                    <div style="padding: 10px">
                        <el-avatar shape="square"
                                :src="imageBase64" ></el-avatar>
                    </div>
                    <el-dropdown-menu slot="dropdown" class="el-dropdown-menu">
                        <el-dropdown-item>
                            <a th:href="@{user_info}" target="openArea">
                                <el-link type="primary"><i class="el-icon-user"></i>个人资料</el-link>
                            </a>
                        </el-dropdown-item>
                        <el-dropdown-item>
                            <a th:href="@{logout}"><el-link type="primary"><i class="el-icon-switch-button"></i>退出系统</el-link></a>
                        </el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
                <span style="color: white; float: right ;text-align: right;line-height: 60px">
                    在线用户:<shiro:principal property="userName" />
                </span>
            </el-header>
            <el-main class="mainMain">
                <iframe width="100%" height="620px" name="openArea" v-bind:src="iframeUrl" frameborder="0"></iframe>
            </el-main>
            <el-footer>
                <div style="text-align: center;margin-top: 10px">
                    <a target="_blank"  style="display:inline-block;text-decoration:none;height:18px;line-height:18px;">
                        <p style="font-size: 10px;float:left;height:18px;line-height:18px;margin: 0px 0px 0px 5px;">Copyright © 2022 Assets Management Project</p>
                    </a>
                </div>
            </el-footer>
        </el-container>
    </el-container>
</div>
</body>
<script src="/js/vue.js"></script>
<script src="/js/index.js"></script>
<script src="/js/axios.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function () {
            return {
                iframeUrl: "asset_srch",
                isCollapse: false,
                isShow: true,
                imageBase64: '',
            }
        },
        methods: {
            toggleCollapse() {
                this.isShow = !this.isShow;
                this.isCollapse = !this.isCollapse;
            },
            findAccountPhoto(){
                axios.post("/api/user/findAccountInfo").then((res) => {
                    if (res.data == ''){
                        this.$message.error('用户信息过期！请重新登陆');
                        setTimeout("top.location.href = 'logout'",1000)
                    }
                    // 设置当前页的员工列表
                    if (res.data.photoFile==null){
                        this.imageBase64 = "/img/head.png";
                    }else {
                        this.imageBase64 = "data:image/jpeg;base64," + res.data.photoFile;
                    }
                })
            }
        },
        created: function () {
            this.findAccountPhoto();
        },
    })
</script>
</html>
